package programer.interviewer.link;

public class Question10 {
    public ListNode kthToLast(ListNode head, int k) {
        ListNode frontNode = head;
        ListNode behindNode = head;
        while (k >0 && frontNode != null) {
            frontNode = frontNode.next;
            k --;
        }

        while(frontNode != null) {
            frontNode = frontNode.next;
            behindNode = behindNode.next;
        }
        return behindNode;
    }



    public static void main(String[] args) {
        new Question9().removeDuplicateNodes(null);
    }
}
